<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateMessagesTable extends Migration
{

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('messages', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name', 100)->index();
            $table->string('title', 100)->nullable();
            $table->string('subtitle', 100)->nullable();
            $table->text('long_desc');
            $table->timestamp('start_at')->nullable();
            $table->timestamp('end_at')->nullable();
            $table->timestamp('online_at')->nullable();
            $table->timestamp('offline_at')->nullable();
            $table->timestamp('publish_at')->nullable();
            $table->unsignedTinyInteger('online_status')->default(0);
            $table->unsignedTinyInteger('publish_status')->default(0);
            $table->unsignedTinyInteger('publish_down_status')->default(1);
            $table->unsignedTinyInteger('moderate_status')->default(0);
            $table->string('moderate_by')->default('0')->nullable();
            $table->timestamp('moderate_at')->nullable();
            $table->integer('user_id')->nullable();
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('messages');
    }
}
